using UnityEngine;

public class PlayerState_Air : PlayerState
{
    private float speed = 0f; 
    
    public PlayerState_Air(Player player, PlayerStateMachine stateMachine, string animBoolName) : base(player, stateMachine, animBoolName)
    {
    }

    public override void Enter()
    {
        base.Enter();
        
        // speed = Mathf.Abs(player.GetVelocity().x) / player.moveSpeed + player.airSpeed;
        // if (speed > 1.0f) speed = 1.0f;

        speed = 1f;
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();
    
        // player.Movement(MoveActionValue * speed);
        player.Movement(new Vector3(MoveActionValue.x, -1, MoveActionValue.y));
       
        if (player.movement.IsWall())
        {
            stateMachine.ChangeState(player.wallSlideState);
            return;
        }
        
        if (player.movement.IsGround()) 
        {
            stateMachine.ChangeState(player.idleState);
            return;
        }
    }
}
